package com.ruoyi.system.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.system.domain.WdyBuyProduct;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 购买记录 服务层
 * 
 * @author ruoyi
 * @date 2019-12-15
 */
public interface IWdyBuyProductService extends IService<WdyBuyProduct>
{
	/**
     * 查询购买记录信息
     * 
     * @param id 购买记录ID
     * @return 购买记录信息
     */
	public WdyBuyProduct selectWdyBuyProductById(Long id);
	
	/**
     * 查询购买记录列表
     * 
     * @param wdyBuyProduct 购买记录信息
     * @return 购买记录集合
     */
	public List<WdyBuyProduct> selectWdyBuyProductList(WdyBuyProduct wdyBuyProduct);
	
	/**
     * 新增购买记录
     * 
     * @param wdyBuyProduct 购买记录信息
     * @return 结果
     */
	public int insertWdyBuyProduct(WdyBuyProduct wdyBuyProduct);
	
	/**
     * 修改购买记录
     * 
     * @param wdyBuyProduct 购买记录信息
     * @return 结果
     */
	public int updateWdyBuyProduct(WdyBuyProduct wdyBuyProduct);
		
	/**
     * 删除购买记录信息
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	public int deleteWdyBuyProductByIds(String ids);

	@Transactional(rollbackFor = Exception.class)
	void buy(WdyBuyProduct buyProduct);

	@Transactional(rollbackFor = Exception.class)
	void active(WdyBuyProduct wdyBuyProduct);

    void incrReleaseAmount(String referrerId);

	Map<String, BigDecimal> getSum(WdyBuyProduct wdyBuyProduct);

	@Transactional(rollbackFor = Exception.class)
	void buyUseCnn(WdyBuyProduct buyProduct);

    void incrReleaseAmount(String userId, BigDecimal incrAmount);
}
